<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/7/25 0025
 * Time: 14:34
 */

namespace app\storage\model;


use think\Model;

class SmtInflowModel extends Model
{
    protected $table = 'smt_inflow';
    protected $pk = 'uuid';
    public function getSmtInflow($condition){
        $where = $condition['where'];
        $pageIndex = $condition['pageIndex'];
        $pageSize = $condition['pageSize'];
        $ret['total'] = $this->where($where)->count();
        $ret['row'] = $this
            ->alias('si')
            ->where($where)
            ->join(['smt_feed_station_detail' => 'detail'], 'si.feed_detail_uuid = detail.uuid')
            ->join(['iwh_storage' => 'storage'], 'storage.uuid = si.storage_uuid')
            ->order('time desc')
            ->page($pageIndex,$pageSize)
            ->field('si.*,storage.name,storage.uuid,detail.feed_id,detail.machine_id,detail.seat_code')
            ->select();
        return $ret;

    }
}